enum Keys {
    Token = 'token',
    UserId= 'userId',
    ExpireTime = 'expireTime'
}

// 存放token
export const setToken = (token:string) => {
    sessionStorage.setItem(Keys.Token,token)
}

// 取出token
export const getToken = () => {
    return sessionStorage.getItem(Keys.Token)
}

// 存放用户id
export const setUserId = (userId:number) => {
    sessionStorage.setItem(Keys.UserId,JSON.stringify(userId))
}

// 取出userId
export const getUserId = () => { 
    return sessionStorage.getItem(Keys.UserId)
}

// 存储过期时间
export const setExpireTime = (time:number) => { 
    sessionStorage.setItem(Keys.ExpireTime,JSON.stringify(time)) 
}

// 取出过期时间
export const getExpireTime = () => { 
    return sessionStorage.getItem(Keys.ExpireTime) 
}

// sessionStorage清空
export const cleanSession = () => {
    sessionStorage.clear()
}